"use strict";
cc._RF.push(module, '30de07vUj1Ckqt6CK40Y8xf', 'RewardView');
// scripts/O1ModuleRes/control/RewardView.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var userInterface_1 = require("../../engines/services/userContent/userInterface");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var RewardView = /** @class */ (function (_super) {
    __extends(RewardView, _super);
    function RewardView() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.BgLight = null;
        _this.lbTitle = null;
        _this.lbCount = null;
        _this.spRewardIcon = null;
        _this.spfPower = null;
        _this.spfCoin = null;
        _this.spfDiamond = null;
        return _this;
    }
    RewardView.prototype.onLoad = function () {
        this.spRewardIcon.spriteFrame = null;
        this.lbTitle.string = '恭喜';
        //
        this.OnIn();
        this.node.zIndex = cc.macro.MAX_ZINDEX;
    };
    RewardView.prototype.OnShowReward = function (rewardType, rewardCount, titleString, customSpriteFrame) {
        if (titleString === void 0) { titleString = '恭喜'; }
        this.lbTitle.string = titleString;
        this.lbCount.string = "+" + Math.floor(rewardCount);
        //
        switch (rewardType) {
            case userInterface_1.REWARD_TYPE.POWER: {
                this.spRewardIcon.spriteFrame = this.spfPower;
                break;
            }
            case userInterface_1.REWARD_TYPE.COIN: {
                this.spRewardIcon.spriteFrame = this.spfCoin;
                break;
            }
            case userInterface_1.REWARD_TYPE.DIAMOND: {
                this.spRewardIcon.spriteFrame = this.spfDiamond;
                break;
            }
            case userInterface_1.REWARD_TYPE.CUSTOM: {
                this.spRewardIcon.spriteFrame = customSpriteFrame;
                break;
            }
            default: {
                console.error('错误的奖励类型', rewardType);
                break;
            }
        }
    };
    RewardView.prototype.OnRewardBg = function () {
        //
        cc.tween(this.BgLight)
            .by(1, { angle: 120 })
            .repeatForever()
            .start();
    };
    RewardView.prototype.OnBtnKnow = function () {
        this.OnOut();
    };
    RewardView.prototype.OnIn = function () {
        this.node.scale = 0.1;
        this.OnRewardBg();
        cc.tween(this.node)
            .to(0.3, { scale: 1 }, { easing: 'backOut' })
            .call(function () {
            // this.OnRewardBg();
        })
            .start();
    };
    RewardView.prototype.OnOut = function () {
        var _this = this;
        cc.tween(this.node).to(0.3, { scale: 0.1 }, { easing: "backIn" }).call(function () {
            _this.node.removeFromParent();
            _this.node.destroy();
        }).start();
    };
    __decorate([
        property(cc.Node)
    ], RewardView.prototype, "BgLight", void 0);
    __decorate([
        property(cc.Label)
    ], RewardView.prototype, "lbTitle", void 0);
    __decorate([
        property(cc.Label)
    ], RewardView.prototype, "lbCount", void 0);
    __decorate([
        property(cc.Sprite)
    ], RewardView.prototype, "spRewardIcon", void 0);
    __decorate([
        property(cc.SpriteFrame)
    ], RewardView.prototype, "spfPower", void 0);
    __decorate([
        property(cc.SpriteFrame)
    ], RewardView.prototype, "spfCoin", void 0);
    __decorate([
        property(cc.SpriteFrame)
    ], RewardView.prototype, "spfDiamond", void 0);
    RewardView = __decorate([
        ccclass
    ], RewardView);
    return RewardView;
}(cc.Component));
exports.default = RewardView;

cc._RF.pop();